/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Rada.Html;

import Rada.RObject;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;


/**
 *
 * @author Miguel
 */
public class Tr extends RObject{
    public int span;
    List<Td> cols;
    public Td TdCurrent;
    public Tr(){
        super();
        cols = new ArrayList<Td>();
    }
    public void add(RObject value){
        TdCurrent = new Td(value);
        cols.add(TdCurrent);
    }
    public void addColSpan(RObject value, int span){
        TdCurrent = new Td(value);
        TdCurrent.colSpan = span;
        cols.add(TdCurrent);
    }
    public void addRowSpan(RObject value, int span){
        TdCurrent = new Td(value);
        TdCurrent.rowSpan = span;
        cols.add(TdCurrent);
    }
    public void addSpan(RObject value, int c, int r){
        TdCurrent = new Td(value);
        TdCurrent.colSpan = c;
        TdCurrent.rowSpan = r;
        cols.add(TdCurrent);
    }
    @Override
    public String show(){
        html="";
        Iterator it;
        it = cols.listIterator();
        html+="<tr ";
        html+=getProperties();
        html+=">";
        while (it.hasNext()){
            html+=((Td)it.next()).show();
        }
        html+="</tr>";
        return html;
    }
}
